package com.briup.cms.service;

import com.briup.cms.bean.BaseLog;
import com.briup.cms.dao.LogMapper;
import com.briup.cms.exception.CustomerException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BaseLogServiceImpl implements IBaseLogService{

    @Autowired
    private LogMapper mapper;

    @Override
    public PageInfo<BaseLog> pageQuery(int pageNum, int pageSize) throws CustomerException {

        PageHelper.startPage(pageNum, pageSize);
        List<BaseLog> list = mapper.findAllLog();
        PageInfo<BaseLog> info = new PageInfo<>(list);

        System.out.println("分页的数量:" + info.getSize());
        return info;
    }

    @Override
    public void AddLogInfo(BaseLog baseLog) {

        mapper.insertLog(baseLog);
        System.out.println("正在保存日志信息："+baseLog);
    }
}
